<?php
/*========================================= JooSam =========================================/
/																							/
/	Extention:		JooSam																	/
/	Created by:		Broadcastweb.eu - Paules												/
/	Site:			http://www.broadcastweb.eu												/
/	Email:			support@broadcastweb.eu													/
/	Copyright:		2011 - 2012 (c) Broadcastweb.eu											/
/	License:		CC BY-NC-ND 3.0 ~ http://creativecommons.org/licenses/by-nc-nd/3.0/		/
/	File Version:	0003																	/
/																							/
/========================================== JooSam ========================================*/
// Joomla security
defined('_JEXEC') or die;
jimport('joomla.application.component.controlleradmin');

// Controller Servers view
class JooSamControllerTextcodes extends JControllerAdmin{
	protected $text_prefix = 'Textcodes';

	public function delete(){
		$data = JRequest::getVar('cid');
		$sqlid = (int)$data[0];

		$del_str = $this->sqldelstring($sqlid);

		if($del_str){
			$this->setMessage(JText::_('COM_JOOSAM_TXTS_CONT_DELETE'));
			$this->setRedirect(JRoute::_('index.php?option=com_joosam&view=textcodes', false));
		}
		else{
			$this->setMessage(JText::_('COM_JOOSAM_TXTS_CONT_DELETE_ERROR'));
			$this->setRedirect(JRoute::_('index.php?option=com_joosam&view=textcodes', false));
		}
	}

	// Delete server
	protected function sqldelstring($sqlid){
		$db =& JFactory::getDBO();
		$query = " DELETE FROM ".$db->nameQuote('#__joosam_textstrings')." WHERE ".$db->nameQuote('id')." = ".$db->quote($sqlid).";";
		$db->setQuery($query);
		$result = $db->query();
		if($result){return true;}
		else{ return false;}
	}

	// Model
	public function &getModel($name = 'Textcodes', $prefix = 'JooSamModel'){
		$model = parent::getModel($name, $prefix, array('ignore_request' => true));
		return $model;
	}
}